<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>自定义指令</title>
</head>
<body>
<p></p>
<div id="app">
    <p v-html="content"></p>
    <input type="text" v-focus>
</div>
<script src="vue.js"></script>
<script>
    new Vue({
        el:'#app',
        data(){
            return {
                content:'这是一段内容'
            }
        },
        directives:{
            focus:function (el,binding,vNode) {
                console.log(el);
                console.log(binding);
                console.log(vNode);
                el.focus();
            }
        }
    })
    var p = document.getElementsByTagName('p');
    p[0].innerHTML = '这是一段内容';
</script>
</body>
</html>